package com.neuedu.spring.autowire.controller;

import com.neuedu.spring.autowire.service.IUserService;
import com.neuedu.spring.autowire.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;


//@Component
@Controller
public class UserController {


//    @Resource(name="MyUserService") //默认


    @Autowired   //默认按照类型匹配的
//    @Qualifier("userService2")
    private IUserService userService;

    public void m1() {
        System.out.println("UserController.m1");
        userService.sayHi();
    }


}
